/**
 *
 * @param {Array} meunList 获取接口中的路由表
 * @param {Array} allRouter 获取本地的路由表
 */
function recombinationRouter(meunList = [], allRouter = []) {
  // console.log(meunList, "meunList");
  // console.log(allRouter, "allRouter");
  let newRoutersArr = [];
  let arrnew = [];
  if (meunList.length > 0) {
    meunList.forEach((p) => {
      allRouter.forEach((r) => {
        if (p.title === r.meta.title) {
          newRoutersArr.push(r);
          if (p.children && p.children.length > 0) {
             r.children= recombinationRouter(p.children, r.children);
            // console.log(r.children,"pppp");
          }
        }
      });
    });
  }

  return newRoutersArr;
}

export default recombinationRouter;
